
local meta = FindMetaTable("Player")
local ent = FindMetaTable("Entity")

function meta:SetKicking( distance, force )
	
	timer.Destroy(tostring(self)..".ballcheck")

	local function CheckForBalls()
		local ent = ents.FindInSphere( self:GetPos(), distance )
		
		for k,v in pairs(ent) do
			if v:GetClass() == "soccerball" then
				
				local phys = v:GetPhysicsObject()
				
				local selfPos = self:GetPos() + Vector( 0, 0, 14 )
				local physPos = v:GetPos()
				
				local dist = ( ( selfPos:Distance(physPos) * -1 ) + (distance + 25) )
				local dist = dist * 0.6 * 0.1
				
				local pos = ( ( physPos - selfPos ) )
				
				phys:SetVelocity( (pos * force) * dist )
				
			end
		end
	end
	
	timer.Create(tostring(self)..".ballcheck", 0.0001, 0, CheckForBalls)
end